#pragma once

#include <stack>

namespace jianzhi_009
{

class CQueue
{
public:
    void appendTail(int value)
    {
        m_queue.push(value);
    }

    int deleteHead()
    {
        if (m_reverse_queue.empty()) {
            while (!m_queue.empty()) {
                m_reverse_queue.push(m_queue.top());
                m_queue.pop();
            }
        }
        if (m_reverse_queue.empty())
            return -1;
        auto top = m_reverse_queue.top();
        m_reverse_queue.pop();
        return top;
    }

private:
    std::stack<int> m_queue;
    std::stack<int> m_reverse_queue;
};

/**
 * Your CQueue object will be instantiated and called as such:
 * CQueue* obj = new CQueue();
 * obj->appendTail(value);
 * int param_2 = obj->deleteHead();
 */

}  /* namespace jianzhi_009 */
